$(document).ready(function(){
	var id = parseInt(localStorage.getItem("id"));
	$("#addToshoppingCar").on("click",function(){
		if(sessionStorage.getItem("loginUser") == null){
			alert("请先登录！！！");
		} else {
			var goods_name = $("#goods_name").text();
			var goods_price = $("#goods_price").text();
			var goods_integral = $("#goods_integral").text();
			var goods_img = $("#goods_img").attr("src");
			
			id++;
			localStorage.setItem("id",id)
			goods_id = "000000" + id;
			var goods = new Object();
			goods.id= goods_id;
			goods.name = goods_name;
			goods.price = goods_price;
			goods.integral = goods_integral;
			goods.img = goods_img;
			var str = JSON.stringify(goods);
			localStorage.setItem(goods.id,str);
		}
	});
	
	$("#shoppingCar").on("click",function(){
		if(sessionStorage.getItem("loginUser") == null){
			alert("请先登录！！！");
		} else {
			$(this).attr("href","shoppingCar.html");
		}
	});
	
	var str = sessionStorage.getItem("temp");
	var goods = JSON.parse(str);
	
	$(".goods_img").attr("src",goods.img);
	$("#goods_name").text(goods.name);
	$("#goods_price").text(goods.price);
	$("#goods_sales").text(goods.sales);
	$("#goods_comments").text(goods.comments);
	$("#goods_integral").text(goods.integral);
});